﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PefStudio.StartUp;
using WeifenLuo.WinFormsUI.Docking;

namespace PefStudio.Windows
{
    [InheritedExport]
    public partial class AbstractDocument : DockContent, IDocument
    {
        public const string DockTabContextMenuContract = "PefStudio.Windows.DockDocument.TabContextMenu";
        public AbstractDockDocument ParentDockDocument;

        public AbstractDocument()
        {
            InitializeComponent();
        }

        public string Title
        {
            get
            {
                return TabText;
            }
            set
            {
                if (TabText == value)
                    return;

                TabText = value;
                OnTitleChanged(EventArgs.Empty);
            }
        }

        public event EventHandler TitleChanged;
        void OnTitleChanged(EventArgs e)
        {
            if (TitleChanged != null)
            {
                TitleChanged(this, e);
            }
        }

        public void RefreshActiveStatus()
        {
            OnActivated(new EventArgs());
        }

        [Import(Bootstrapper.MainWindowContract, typeof(Form))]
        private Lazy<MainWindow> mainWindow { get; set; }
        protected MainWindow MainWindow
        {
            get { return mainWindow.Value; }
        }


        public string Description
        {
            get { return string.Empty; }
        }
    }
}
